# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=sqlsus
pkgver=0.7.2
pkgrel=12
groups=('blackarch' 'blackarch-exploitation' 'blackarch-webapp')
pkgdesc='An open source MySQL injection and takeover tool.'
arch=('any')
url='http://sqlsus.sourceforge.net/'
license=('GPL2')
depends=('perl' 'perl-libwww' 'perl-dbd-sqlite' 'perl-www-mechanize'
         'perl-lwp-protocol-https' 'perl-switch' 'perl-html-linkextractor')
optdepends=('perl-lwp-protocol-socks: SOCKS proxy support'
            'perl-term-readline-gnu: better readline support with AddHistory')
source=("http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tgz")
sha512sums=('58e2c6e47b409f7f2001c7a0d2932310e8f49bcc2bba998b6cb29fa04ff01ab9d0448cadc5539df63fbe20f9c2bd3c079c1c479ec3806e5c71561f7b5bd97ac2')

prepare() {
  cd "$pkgname-$pkgver"

  sed -i 's|defined @history|@history|g' $pkgname
}

package() {
  cd "$pkgname-$pkgver"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" CHANGELOG README

  rm -rf CHANGELOG README LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec perl $pkgname "\$@"
EOF
  chmod +x "$pkgdir/usr/bin/$pkgname"
}

